package com.shuaigef.springbootinit.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 
 * @TableName exercise
 */
@TableName(value ="exercise")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Exercise implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer exerciseId;

    /**
     * 题目内容
     */
    private String exerciseContent;

    /**
     * 题目类型
     */
    private String exerciseType;

    /**
     * 题目答案
     */
    private String exerciseAnswer;

    /**
     * 难度
     */
    private String exerciseDifficulty;

    private String exerciseSymbol;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Exercise other = (Exercise) that;
        return (this.getExerciseId() == null ? other.getExerciseId() == null : this.getExerciseId().equals(other.getExerciseId()))
            && (this.getExerciseContent() == null ? other.getExerciseContent() == null : this.getExerciseContent().equals(other.getExerciseContent()))
            && (this.getExerciseType() == null ? other.getExerciseType() == null : this.getExerciseType().equals(other.getExerciseType()))
            && (this.getExerciseAnswer() == null ? other.getExerciseAnswer() == null : this.getExerciseAnswer().equals(other.getExerciseAnswer()))
            && (this.getExerciseDifficulty() == null ? other.getExerciseDifficulty() == null : this.getExerciseDifficulty().equals(other.getExerciseDifficulty()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getExerciseId() == null) ? 0 : getExerciseId().hashCode());
        result = prime * result + ((getExerciseContent() == null) ? 0 : getExerciseContent().hashCode());
        result = prime * result + ((getExerciseType() == null) ? 0 : getExerciseType().hashCode());
        result = prime * result + ((getExerciseAnswer() == null) ? 0 : getExerciseAnswer().hashCode());
        result = prime * result + ((getExerciseDifficulty() == null) ? 0 : getExerciseDifficulty().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", exerciseId=").append(exerciseId);
        sb.append(", exerciseContent=").append(exerciseContent);
        sb.append(", exerciseType=").append(exerciseType);
        sb.append(", exerciseAnswer=").append(exerciseAnswer);
        sb.append(", exerciseDifficulty=").append(exerciseDifficulty);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}